package poo.exo1;

public abstract class Compte
{
	final protected String nom;
	final protected int numero;
	protected double solde;
	protected int type;
	protected boolean ouvert;

	abstract public boolean retirer(double somme) throws MyException;

	abstract public boolean deposer(double somme) throws MyException;

	abstract public boolean transferer(double somme, Compte cible) throws MyException;

	public boolean isOuvert()
	{
		return ouvert;
	}

	public void setOuvert(boolean ouvert)
	{
		this.ouvert = ouvert;
	}

	public double getSolde()
	{
		return solde;
	}

	public void setSolde(double solde)
	{
		this.solde = solde;
	}

	public String getNom()
	{
		return nom;
	}

	public int getNumero()
	{
		return numero;
	}

	public Compte(String nom, int numeroCompte, double solde)
	{

		this.nom = nom;
		this.numero = numeroCompte;
		this.solde = solde;
		this.ouvert = true;

	}

	public int getType()
	{
		return type;
	}

	@Override
	public String toString()
	{
		StringBuffer retValue = new StringBuffer();

		retValue.append("\n Nom: ").append(this.nom).append("\n Numero = ").append(this.numero).append("\n Solde = ")
				.append(this.solde);

		return retValue.toString();
	}

}
